home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / misc / gs261src.zip / istack.h < prev    next >
C/C++ Source or Header  |  1993-05-13  |  2KB  |  60 lines

  1. /* Copyright (C) 1992 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* istack.h */
  20. /* Definitions for Ghostscript stacks */
  21.  
  22. #ifndef istack_INCLUDED
  23. #  define istack_INCLUDED
  24.  
  25. /********************************
  26.  * NOTE: on MS-DOS systems, the stacks are stored in the data segment.
  27.  * This leads to large performance gains, at the expense of having to swap
  28.  * the stacks explicitly when switching contexts or handling segment under-
  29.  * or overflow (none of which are implemented yet!).
  30.  ********************************/
  31.  
  32. typedef ref _ds *s_ptr;
  33. typedef const ref _ds *const_s_ptr;
  34.  
  35. /*
  36.  * Eventually, stacks will be allocated in linked chunks;
  37.  * only the current chunk will be kept in the data segment.
  38.  * For now, there is only one chunk.
  39.  */
  40. typedef struct ref_stack_chunk_s ref_stack_chunk;
  41. struct ref_stack_chunk_s {
  42.     ref_stack_chunk *next;        /* next lower chunk on stack */
  43.     uint used_size;
  44.     ref contents;            /* t_array */
  45. };
  46. /*
  47.  * The base of the stack is allocated statically.
  48.  */
  49. typedef struct ref_stack_s {
  50.     s_ptr p;            /* current top element */
  51.     s_ptr bot;            /* bottommost valid element */
  52.     s_ptr top;            /* topmost valid element */
  53.     uint bot_guard;            /* # of guard elements below bot */
  54.     uint top_guard;            /* # of guard elements above top */
  55.     ulong extension_size;        /* total used_sizes of other chunks */
  56.     ref_stack_chunk *next;        /* lower chunks */
  57. } ref_stack;
  58.  
  59. #endif                    /* istack_INCLUDED */
  60.